<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>小区站点</title>
    <link rel="stylesheet" href="../../libs/node_modules/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../style/common.css">
    <link rel="stylesheet" href="../../style/home/article.css">
    <link rel="stylesheet" href="../../style/home/stationB.css">

    <script src="../../libs/vue.js"></script>
    <script src="../../libs/jquery-3.2.1.min.js"></script>
    <script src="../../jsc/axios.min.js"></script>
 <!--   <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
            integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
            crossorigin="anonymous"></script> -->
    <script src="../../libs/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="../../libs/layer-v3.1.1/layer/layer.js"></script>
    <!--<script src="js/system.js"></script>-->
</head>
<body>
<main id="biotope" v-cloak>

<!--    <headertop-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></headertop-component>-->
    <header-component></header-component>
    <navsearch-component></navsearch-component>
    <navlink-component v-if="site_data && site_data.site_id" :siteid="site_data"></navlink-component>

    <!-- 主站导航 -->
    <navrow-component v-if="sitelevel == ''" :siteid="site_data"></navrow-component>
    <!-- 行政站导航 -->
    <navtab2-component v-if="sitelevel != 5 && sitelevel != '' " :siteid="site_data"></navtab2-component>
    <!-- 基层站导航 -->
    <navtab3-component v-if="sitelevel==5" :siteid="site_data"></navtab3-component>

    <div class="content stationB stationC">

        <navlink2-component v-if="site_data && site_data.site_id" :siteid="site_data"></navlink2-component>

        <div class="manager">
            <div class="manager-box">
                <div class="manager-item">
                    <div class="manager-item-title">
                        <div class="manager-item-title-l">政府管理</div>
                        <div @click="goToMore(1)" class="manager-item-title-r">更多&gt;</div>
                    </div>
                    <div class="manager-item-card">
                        <div @click="goToMore(1,biotopeArticle1[0].id)" class="manager-item-card-img" v-if="biotopeArticle1.length && biotopeArticle1[0]" :alt="biotopeArticle1[0].title" :title="biotopeArticle1[0].title"
                             :style="{ 'background-image' : 'url('+ biotopeArticle1[0].coverimages_text[0] +')' }">
                        </div>
                        <div class="manager-item-card-content">
                            <div @click="goToMore(1,item.id)" class="manager-item-card-list" v-if="biotopeArticle1.length && index > 0" v-for="(item,index) in biotopeArticle1">
                                <div class="manager-item-card-list-l" :title="item.title">{{item.title}}</div>
                                <div class="manager-item-card-list-r">{{item.publishtime_text.substring(0,10)}}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="manager-item">
                    <div class="manager-item-title">
                        <div class="manager-item-title-l">业主管理</div>
                        <div @click="goToMore(2)"  class="manager-item-title-r">更多&gt;</div>
                    </div>
                    <div class="manager-item-card">
                        <div @click="goToMore(2,biotopeArticle2[0].id)" class="manager-item-card-img" v-if="biotopeArticle2.length && biotopeArticle2[0]" :alt="biotopeArticle2[0].title" :title="biotopeArticle2[0].title"
                             :style="{ 'background-image' : 'url('+ biotopeArticle2[0].coverimages_text[0] +')' }">
                        </div>
                        <div class="manager-item-card-content">
                            <div @click="goToMore(2,item.id)" class="manager-item-card-list" v-if="biotopeArticle2.length && index > 0" v-for="(item,index) in biotopeArticle2">
                                <div class="manager-item-card-list-l" :title="item.title">{{item.title}}</div>
                                <div class="manager-item-card-list-r">{{item.publishtime_text.substring(0,10)}}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="manager-item">
                    <div class="manager-item-title">
                        <div class="manager-item-title-l">委员会工作</div>
                        <div @click="goToMore(3)"  class="manager-item-title-r">更多&gt;</div>
                    </div>
                    <div class="manager-item-card">
                        <div @click="goToMore(3,biotopeArticle3[0].id)" class="manager-item-card-img" v-if="biotopeArticle3.length && biotopeArticle3[0]" :alt="biotopeArticle3[0].title" :title="biotopeArticle3[0].title"
                             :style="{ 'background-image' : 'url('+ biotopeArticle3[0].coverimages_text[0] +')' }">
                        </div>
                        <div @click="goToMore(3,item.id)" class="manager-item-card-content">
                            <div class="manager-item-card-list" v-if="biotopeArticle3.length && index > 0" v-for="(item,index) in biotopeArticle3">
                                <div class="manager-item-card-list-l" :title="item.title">{{item.title}}</div>
                                <div class="manager-item-card-list-r">{{item.publishtime_text.substring(0,10)}}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="manager-item">
                    <div class="manager-item-title">
                        <div class="manager-item-title-l">服务管理</div>
                        <div @click="goToMore(4)"  class="manager-item-title-r">更多&gt;</div>
                    </div>
                    <div class="manager-item-card">
                        <div @click="goToMore(4,biotopeArticle4[0].id)" class="manager-item-card-img" v-if="biotopeArticle4.length && biotopeArticle4[0]" :alt="biotopeArticle4[0].title" :title="biotopeArticle4[0].title"
                             :style="{ 'background-image' : 'url('+ biotopeArticle4[0].coverimages_text[0] +')' }">
                        </div>
                        <div @click="goToMore(4,itme.id)" class="manager-item-card-content">
                            <div class="manager-item-card-list" v-if="biotopeArticle4.length && index > 0" v-for="(item,index) in biotopeArticle4">
                                <div class="manager-item-card-list-l" :title="item.title">{{item.title}}</div>
                                <div class="manager-item-card-list-r">{{item.publishtime_text.substring(0,10)}}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="manager-item">
                    <div class="manager-item-title">
                        <div class="manager-item-title-l">基层党建</div>
                        <div @click="goToMore(5)"  class="manager-item-title-r">更多&gt;</div>
                    </div>
                    <div class="manager-item-card">
                        <div @click="goToMore(5,biotopeArticle5[0].id)" class="manager-item-card-img" v-if="biotopeArticle5.length && biotopeArticle5[0]" :alt="biotopeArticle5[0].title" :title="biotopeArticle5[0].title"
                             :style="{ 'background-image' : 'url('+ biotopeArticle5[0].coverimages_text[0] +')' }">
                        </div>
                        <div @click="goToMore(5,item.id)" class="manager-item-card-content">
                            <div class="manager-item-card-list" v-if="biotopeArticle5.length && index > 0" v-for="(item,index) in biotopeArticle5">
                                <div class="manager-item-card-list-l" :title="item.title">{{item.title}}</div>
                                <div class="manager-item-card-list-r">{{item.publishtime_text.substring(0,10)}}</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="manager-login" v-if="!login">
                <div class="manager-login-btn" onclick="window.location.href='../../views/login/login.html'">政府管理 点击登录</div>
                <div class="manager-login-btn" onclick="window.location.href='../../views/login/login.html'">民主管理 点击登录</div>
                <div class="manager-login-btn" onclick="window.location.href='../../views/login/login.html'">委会工作 点击登录</div>
                <div class="manager-login-btn" onclick="window.location.href='../../views/login/login.html'">服务管理 点击登录</div>
                <div class="manager-login-btn" onclick="window.location.href='../../views/login/login.html'">基层党建 点击登录</div>
            </div>
        </div>

        <tasklist-component v-if="site_data && site_data.site_id" :siteid="site_data"></tasklist-component>
        <liveserve-component v-if="site_data && site_data.site_id" :siteid="site_data"></liveserve-component>

        <div class="Exhibition-container">
            <div class="Exhibition-l">
                <classifysite-component v-if="site_data && site_data.site_id" :siteid="site_data"></classifysite-component>
                <knowledge-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></knowledge-component>
                <legalsystem-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></legalsystem-component>
                <report-component v-if="site_data && site_data.site_id" :siteid="site_data"></report-component>
            </div>
            <div class="Exhibition-r">
                <notice-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></notice-component>
                <survey-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></survey-component>
                <news-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></news-component>
                <publicinterest-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></publicinterest-component>
            </div>
        </div>
        <div class="adv-row" v-if="banner2.length">
            <a :href="item.url" v-for="(item,index) in banner2" :title="item.name" v-if="index > 4">
                <img :src="item.image_text" :alt="item.name" style="height: 5.75rem">
            </a>
        </div>
        <div class="adv-row" v-if="banner3.length">
            <a :href="item.url" v-for="(item,index) in banner3" :title="item.name" v-if="index > 4">
                <img :src="item.image_text" :alt="item.name" style="height: 5.75rem">
            </a>
        </div>
        <friend-component></friend-component>
    </div>
    <footer-component url="../../"></footer-component>
</main>
<script src="../../jsc/common.js"></script>
<script src="../../jsc/component.js"></script>
<script>
    var site = JSON.parse(window.localStorage.getItem("station")) || {}
</script>
<script>
    var search = new Vue({
        el      : "#biotope" ,
        data    : {
            parameter    : parameter,
            bannerList   : [ 44 , 45 , 42 ] ,              // 行政区域bannber category_id(分类id);
            adminArray   : [ 73 , 74 , 75 ] ,
            biotopeArray : [ 99 , 102 , 108 , 117 , 123 ] ,     // 小区区域 文章数据 47=政府管理,48=民主管理,49=委员会工作,50=服务管理,51=基层管理
            id           : { province_id : 1 } ,

            site_data : "" ,
            banber1   : "" ,                  // banner 分站顶部广告
            banner2   : "" ,                  // banner 分站导航栏下1x4广告
            banner3   : "" ,                  // banner 首页底部1x1广告

            biotopeArticle1 : "" ,             // 文章列表 47 = 政府管理
            biotopeArticle2 : "" ,             // 文章列表 48 = 民主管理
            biotopeArticle3 : "" ,             // 文章列表 49 = 委员会工作
            biotopeArticle4 : "" ,             // 文章列表 50 = 服务管理
            biotopeArticle5 : "" ,             // 文章列表 51 = 基层管理

            sitelevel:"",

			login : getCookie('token') || ''
        } ,
        mounted(){
            this.type      = parameter.type;
            this.keyWord   = decodeURIComponent(parameter.keyword);

            if(this.parameter.siteid && ( this.parameter.siteid != site.site_id) ){
                axios.post(sysurl + 'user/siteInfo' , {site_id : this.parameter.siteid} ).then(res => {
                    var datas = res.data;
                    if( datas.code === 1 ){
                        window.localStorage.setItem("station",JSON.stringify(datas.data));
                        this.site_data = datas.data;
                        this.sitelevel = datas.data.site_level;

                        this.getBannerList();
                        this.getSiteNavigation();
                        this.getSurveyList();
                    }else{
                        layer.msg(res.data.msg);
                    }
                } , err => {}).catch(( error ) => {});
            }else{
                this.site_data = site;
                this.sitelevel = site.site_level;

                this.getBannerList();
                this.getSiteNavigation();
                this.getSurveyList();
            }
        } ,
        methods : {
            // 获取 行政区域 bannber
            getBannerList(){
                this.bannerList.map(( item , index ) => {
                    axios.post(sysurl + 'index/bannerAds' , { site_id : this.site_data.site_id , category_id : item }).then(res => {
                        var data = res.data;
                        if( data.code == 1 ){
                            switch( item ){
                                case 44:
                                    this.banner1 = data.data;
                                    break;
                                case 45:
                                    this.banner2 = data.data;
                                    break;
                                case 42:
                                    this.banner3 = data.data;
                            }
                        }else{
                            layer.msg(res.data.msg);
                        }
                    } , err => {}).catch(( error ) => {});
                });
            } ,
            // 行政站 ： category_id :  47=政府管理,48=民主管理,49=委员会工作,50=服务管理,51=基层管理
            getSiteNavigation(){
                this.biotopeArray.map((item,index) => {
                    var forms = new FormData()
                    forms.append("site_id",this.site_data.site_id)
                    forms.append("nav_id",item)
                    forms.append("limit",7)
                    forms.append("page",1)
                    axios.post(sysurl + 'index/navGetArticle' , forms).then(res => {
                        var data = res.data;
                        if( data.code == 1 ){
                            switch( item ){
                                case 99:        // 47 = 政府管理
                                    this.biotopeArticle1 = data.data.data;
                                    break;
                                case 102:        // 48 = 民主管理
                                    this.biotopeArticle2 = data.data.data;
                                    break;
                                case 108:        // 49 = 委员会工作
                                    this.biotopeArticle3 = data.data.data;
                                    break;
                                case 117:        // 50 = 服务管理
                                    this.biotopeArticle4 = data.data.data;
                                    break;
                                case 123:        // 51 = 基层管理
                                    this.biotopeArticle5 = data.data.data;
                                    break;
                            }
                        }else{
                            layer.msg(res.data.msg);
                        }
                    } , err => {}).catch(( error ) => {});
                })
            } ,
            // 获取家园调查4条数据
            getSurveyList(){
                axios.post(sysurl + 'index/survey' , {site_id:this.site_data.site_id}).then(res => {
                    var data = res.data;
                    if( data.code === 1 ){
                        this.surveyList = data.data;
                    }else{
                        layer.msg(res.data.msg);
                    }
                } , err => {}).catch(( error ) => {});
            },
            // 查看更多
            goToMore(type,id){
                // if(type == 'detail'){
                //     window.location.href = `../../views/site/sitelist.html?id=${id}&category_id=${category_id}&category_name=${name}&type=detail`;
                // }else{
                //     window.location.href = `../../views/site/sitelist.html?id=${category_id}&category_name=${name}`;
                // }


                if(id!=undefined){
                    var forms = new FormData()
                    forms.append("article_id",id)
                    forms.append("type",3)
                    axios.post(sysurl + 'index/articleCategoryGetNavId',forms).then(res => {
                        var data = res.data;
                        if( data.code === 1 ){
                            if(type == 1){
                                window.location.href ="../../views/about/public.html?id=99&station_type=3&banner_type=243#/3?id="+data.data.id+"&url="+data.data.url+"&a_id="+id
                            }
                            else if(type == 2){
                                window.location.href ="../../views/about/public.html?id=102&station_type=3&banner_type=242#/3?id="+data.data.id+"&url="+data.data.url+"&a_id="+id

                            }
                            else if(type == 3){
                                window.location.href ="../../views/about/public.html?id=108&station_type=3&banner_type=241#/3?id="+data.data.id+"&url="+data.data.url+"&a_id="+id

                            }
                            else if(type == 4){
                                window.location.href ="../../views/about/public.html?id=117&station_type=3&banner_type=240#/3?id="+data.data.id+"&url="+data.data.url+"&a_id="+id

                            }
                            else if(type == 5){
                                window.location.href ="../../views/about/public.html?id=123&station_type=3&banner_type=239#/3?id="+data.data.id+"&url="+data.data.url+"&a_id="+id

                            }
                        }else{
                            layer.msg(res.data.msg);
                        }
                    } , err => {}).catch(( error ) => {});
                }else{
                    if(type == 1){
                        window.location.href ="../../views/about/public.html?id=99&station_type=3&banner_type=243"
                    }
                    else if(type == 2){
                        window.location.href ="../../views/about/public.html?id=102&station_type=3&banner_type=242"

                    }
                    else if(type == 3){
                        window.location.href ="../../views/about/public.html?id=108&station_type=3&banner_type=241"

                    }
                    else if(type == 4){
                        window.location.href ="../../views/about/public.html?id=117&station_type=3&banner_type=240"

                    }
                    else if(type == 5){
                        window.location.href ="../../views/about/public.html?id=123&station_type=3&banner_type=239"

                    }
                }



            }
        } ,
        filters : {}
    });
</script>
</body>
</html>
